<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRentHousesTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('rent_houses', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->default(0)->comment('房东用户 id');
            $table->string('address')->nullable()->comment('位置');
            $table->string('size')->nullable()->comment('尺寸');
            $table->tinyInteger('lease_mode')->default(0)->comment('1 整租 2 合租');
            $table->tinyInteger('specs')->default(0)->comment('规格 1 单室 2 双室 3 三室及以上');
            $table->string('price')->nullable()->comment('价格');
            $table->string('house_pic')->nullable()->comment('房屋图片');
            $table->text('house_desc')->comment('房屋描述');
            $table->string('contacts_name')->nullable()->comment('联系人姓名');
            $table->string('contacts_phone')->nullable()->comment('联系人电话');
            $table->tinyInteger('check_status')->default(0);
            $table->string('check_message')->nullable()->comment('审核信息');
            $table->integer('expire_time')->default(0)->comment('过期时间');
            $table->integer('push_time')->default(0)->comment('发布时间');
            $table->integer('order_num')->default(0)->comment('排序字段 优先使用这个 其次使用 push_time');
            $table->index('user_id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('rent_houses');
    }
}
